<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="format-detection" content="telephone=no,email=no,adress=no"/>
<title>先花花</title>
<link rel="stylesheet" type="text/css" href="css/common.css" />
<script type="text/javascript" src="script/jquery.js"></script>
<script type="text/javascript" src="script/jquery.md5.js"></script>
<script type="text/javascript" src="script/common.js"></script>
<script type="text/javascript" src="script/jquery.cookie.js"></script>
 
<script type="text/javascript">
 $(function()
  {
    $.ajax({
          url:commonUrl+"/Syetemmsg/listMessage",
          data:{userId:uid,appid:appid,appkey:appkey},
          type:"post",
          dataType:"jsonp",
          jsonp:"callback",
          success:function(result){
            str = '<input type="button" class="lookover" value="查看已读消息"><tr><th align="center" valign="middle" class="borderright">标题</th><th align="center" valign="middle" class="borderright">状态</th><th align="center" valign="middle" class="borderright">操作</th></tr>';
            for(var i=0;i<result.length;i++)
            {
              str += '<tr>\
                        <td align="center" valign="middle" class="borderright borderbottom">'+result[i].messageTitle+'</td>\
                        <td align="center" valign="middle" class="borderright borderbottom">'+result[i].status+'</td>\
                        <td align="center" valign="middle" class="borderright borderbottom"><input type="button" class="seedetails" messageId="'+result[i].messageId+'" value="查看详情"></td>\
                      </tr>';
            }
            $('table').html(str);
          }
      });
  })  
  // 查看详情
  $(document).on('click','.seedetails',function()
  {
    var messageId = $(this).attr('messageId');
    $.ajax({
        url:commonUrl+"/Syetemmsg/seeDetails",
        data:{userId:uid,messageId:messageId,appid:appid,appkey:appkey},
        type:"post",
        dataType:"jsonp",
        jsonp:"callback",
        success:function(result){
          str = '<tr><th align="center" valign="middle" class="borderright">标题</th><th align="center" valign="middle" class="borderright">内容</th><th align="center" valign="middle" class="borderright">时间</th></tr><tr>\
                        <td align="center" valign="middle" class="borderright borderbottom">'+result.messageTitle+'</td>\
                        <td align="center" valign="middle" class="borderright borderbottom">'+result.messageContent+'</td>\
                        <td align="center" valign="middle" class="borderright borderbottom">'+result.messageTime+'</td>\
                      </tr>';
          $('table').html(str);
        }
  });
  });
  // 查看已读消息
  $(document).on('click','.lookover',function()
      {
        $.ajax({
          url:commonUrl+"/Syetemmsg/lookOver",
          data:{userId:uid,appid:appid,appkey:appkey},
          type:"post",
          dataType:"jsonp",
          jsonp:"callback",
          success:function(result){
            str = '<tr><th align="center" valign="middle" class="borderright">标题</th><th align="center" valign="middle" class="borderright">内容</th><th align="center" valign="middle" class="borderright">时间</th><th align="center" valign="middle" class="borderright">操作</th></tr>';
            for(var i=0;i<result.length;i++)
            {
              str += '<tr>\
                        <td align="center" valign="middle" class="borderright borderbottom">'+result[i].messageTitle+'</td>\
                        <td align="center" valign="middle" class="borderright borderbottom">'+result[i].messageContent+'</td>\
                        <td align="center" valign="middle" class="borderright borderbottom">'+result[i].messageTime+'</td>\
                        <td align="center" valign="middle" class="borderright borderbottom"><input type="button" class="deleteMessage" messageId="'+result[i].messageId+'" value="删除"></td>\
                      </tr>';
            }
            $('table').html(str);
          }
        })
      });
    $(document).on('click','.deleteMessage',function()
    {
      var messageId = $(this).attr('messageId');
      obj = $(this);
      $.ajax({
        url:commonUrl+"/Syetemmsg/deleteMessage",
          data:{userId:uid,messageId:messageId,appid:appid,appkey:appkey},
          type:"post",
          dataType:"jsonp",
          jsonp:"callback",
          success:function(result){
            if (result) {
              location.reload() 
            }
          }
      })
    })
</script>
</head>
<body>
<!-- 页面头部 -->
<section>
 <div class="navigation-bar"> <a href="javascript:history.back(-1)" class="z-01"></a> <span>系统消息</span> <a href="index.html" class="z-02"></a> </div>
</section>
<!-- 中间内容 -->
<div class="wrapper">
  <div class="personalform">
    <div class="tzjl-con1" id="touzi" style="min-height:150px;padding-top:100px;text-align:center;background-color:#fff; display:none">您最近还没有投资记录！ </div>
    <div class="c-tabs-cnt c-tzjlinfo" style=" padding-bottom:60px;">
          <table style="width: 100%">
            <tbody id="table">

            </tbody>
          </table>
          <div class="clear"></div>
          <div class="addmore"><a href="#" title="查看更多" class="btn-ckgd">查看更多↓</a> </div>
      </div>
  </div>
  <div class="clear"></div>
</div>
<!-- 页面底部 -->
<nav class="footer border_t" id="footer"> 
  <a href="index.html" class="" id="jx"><span></span>首页</a>
   <a href="list.html" id="lc" class=""><span></span>理财</a> 
  <a href="borrow_money.html" id="jk" class=""><span></span>借款</a>
   <a href="user.html" id="cf" class="nav_on"><span></span>我的账户</a> </nav>
</body>
</html>
